home *** CD-ROM | disk | FTP | other *** search
- Path: news.jhu.edu!news
- From: Chenyang Xu <chenyang@mashie.ece.jhu.edu>
- Newsgroups: comp.lang.c
- Subject: C compiling question
- Date: Sat, 02 Mar 1996 18:09:51 -0500
- Organization: ECE Department, The Johns Hopkins University
- Message-ID: <3138D53F.41C6@mashie.ece.jhu.edu>
- NNTP-Posting-Host: 128.220.14.190
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; IRIX 5.2 IP22)
-
- Hi, there,
-
- I have three files here called: foo.c, foo1.c, foo2.c
-
- ===foo.c===
-
- void print_msg1();
- void print_msg2();
-
- main()
- {
- print_msg1();
- print_msg2();
- }
-
- ===foo1.c===
- #include "stdio.h"
- #include "math.h"
-
- void print_msg1()
- {
- float x = 1.0;
- float y;
-
- y = exp(x);
- printf("foo1.c\n");
- printf("%f\n", y);
-
- return;
- }
-
- ===foo2.c===
- void print_msg2()
- {
- printf("foo2.c\n");
- print_msg1();
- return;
- }
-
-
- After compiling with "cc foo.c foo1.c foo2.c -lm -o foo", then type foo
- gives me
- the following result:
-
- foo1.c
- 2.718282
- foo2.c
- foo1.c
- 2.718282
-
- My question is how the print_msg2() knows print_msg1() and carrys out
- the result
- without causing a compiling or linking error or warning,
-
- Thanks for any help.
-
- --
- Chenyang
-
- \\|//
- (o o)
- --------------------------ooO-(_)-Ooo----------------------------------
- (o) 410-516-6819 | Fax:410-516-5566
- chenyang@jhu.edu | http://iacl.ece.jhu.edu/~chenyang
- _________________________________________________________
- / Image Analysis and Communication Lab /
- / Department of the Electric and Computer Engineering /
- / The Johns Hopkins University /
- / Baltimore, MD 21218 /
- =======================================================================
-